package com.glodon.ggzy.jgpt.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.glodon.ggzy.fwpt.dao.IGgCqXmZbtzDao;
import com.glodon.ggzy.jgpt.service.IJgptCqjyService;
import com.glodon.ggzy.vo.JgptCqjy;

@Service
@Transactional
public class JgptCqjyServiceImpl implements IJgptCqjyService {
	
	@Autowired
	IGgCqXmZbtzDao ggCqXmZbtzDao;

	@Override
	public List<JgptCqjy> getCqjyData(Date begin, Date end, String srrType) {
		String hql = "select new com.glodon.ggzy.vo.JgptCqjy(to_char(g.dealDate,'yyyy-mm'),count(g.id),sum(g.dealPrice))" +
				" from GgCqXmZbtz g where g.dealDate between  ? and ? and g.srrType = ?"+
				"group by to_char(g.dealDate,'yyyy-mm') order by to_char(g.dealDate,'yyyy-mm')";
		List<JgptCqjy> cqjyData =  ggCqXmZbtzDao.find(hql, begin,end,srrType);
		
		return cqjyData;
	}

	
}
